﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Bll.Base;
using Watchdog.Bll.Factory;

namespace Watchdog.Bll {

    public partial class TargetType : TargetTypeBase {

        internal TargetType () : base () {}

        internal TargetType ( Facade.TargetType targettype ) : base (targettype) { }
		
		#region [ Parent objects ]


		#endregion

		#region [ Many to many relations ]

		List<Definition> definitions;
		public List<Definition> Definitions {
			get {
				if ( definitions == null )
					definitions = DefinitionFactory.GetByTargetType(this.Id);
				return definitions;
			}
		}

		#endregion

		#region [ Add & Remove methods for many to many relations ]

		public void AddDefinition (Definition definition) {
			TargetTypeFactory.AddDefinition (this, definition);
			//reset the collection;
			definitions = null;
		}

		public void RemoveDefinition (Definition definition) {
			TargetTypeFactory.RemoveDefinition (this, definition);
			//reset the collection;
			definitions = null;
		}

		#endregion
		
		#region [ One to many relations ]

		#endregion
		
		#region [ Add & Remove methods for one to many relations ]

		#endregion

    }
}
